package com.xiaoluo.lottery.common.weixin.utils;

import com.thoughtworks.xstream.XStream;

/**
 * Project : lottery
 * Package : com.xiaoluo.lottery.common.weixin.utils
 * Created by Willian.
 * Date  : 2016/4/7 1:41.
 */
public class XmlUtil {

    public static Object getObjectFromXML(String xml, Class tClass) {
        //将从API返回的XML数据映射到Java对象
        XStream xStreamForResponseData = new XStream();
        xStreamForResponseData.alias("xml", tClass);
        xStreamForResponseData.ignoreUnknownElements();//暂时忽略掉一些新增的字段
        return xStreamForResponseData.fromXML(xml);
    }
}
